#include <all_wlib.h>
#pragma hdrstop
//#pragma package(smart_init)
#pragma resource "*.dfm"

#include "int.h"

#include "nv_Cfg.h"

void Configure( void )
  {  HAutoPtr<TConfigForm> d( new TConfigForm( (TComponent*)NULL ) );

     d->ShowModal();
}

static CONSTSTR SplitFormats[] = { "Squid native", "Naviscope" };

//---------------------------------------------------------------------------
__fastcall TConfigForm::TConfigForm(TComponent* Owner)
    : TForm(Owner)
  {
}
//---------------------------------------------------------------------------
void __fastcall TConfigForm::FormShow(TObject *Sender)
  {
  //Opt->Fields
    chAutosave->Checked       = GOPT( "Autosave", true );
    chUseNames->Checked       = GOPT( "UseNames", false );
    cbSplitFmt->ItemIndex     = GOPT( "SplitFormat", (int)sfSquid );
}
//---------------------------------------------------------------------------
void __fastcall TConfigForm::BitBtn1Click(TObject *Sender)
{
  //Fields -> Opt
    SOPT( "Autosave",       chAutosave->Checked );
    SOPT( "UseNames",       chUseNames->Checked );
    SOPT( "SplitFormat",    cbSplitFmt->ItemIndex );
}
//---------------------------------------------------------------------------
void __fastcall TConfigForm::FormCreate(TObject *Sender)
  {
     for( int n = 0; n < ARRAY_SIZE(SplitFormats); n++ )
       cbSplitFmt->Items->Add( SplitFormats[n] );
}
//---------------------------------------------------------------------------

